package com.coin900.coin.cmd.system_config;

import com.google.gson.Gson;
import com.coin900.coin.cmd.ACmd;
import com.coin900.coin.cmd.CmdSign;
import com.coin900.coin.code.CmdCode;
import com.coin900.coin.persist.sbi.SbiSystemConfigVO;
import com.coin900.coin.service.sbi.ISbiSystemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 查询项目
 *
 * @author shui
 * @create 2017-11-28
 **/
@Controller
public class SystemConfigListCmd extends ACmd {

    @Override
    public CmdSign execute(HttpServletRequest request, CmdSign sign) throws Exception {
        CmdSign respSign = new CmdSign(sign);
        Map<String, Object> params = new HashMap<>();
        params.put("dataStatus", 1);
        List<SbiSystemConfigVO> sbiSystemConfigVOS = systemConfigService.loadSbiSystemConfig(params);
        String source = new Gson().toJson(sbiSystemConfigVOS);
        respSign.setSource(source);
        return respSign;
    }


    @Autowired
    private ISbiSystemConfigService systemConfigService;

    @Override
    public String getCmdCode() {
        return CmdCode.SYSTEM_CONFIG_LIST;
    }
}
